<template>
  <div>
    <div class="findList">
      <ul>
        <li
          v-for="item in info"
          :key="item.houseCode"
          @click="$router.push('/detail/' + item.houseCode)"
        >
          <div class="imgs"><img :src="url + item.houseImg" alt="" /></div>
          <div class="list-content">
            <h3>{{ item.title }}</h3>
            <p class="adress">{{ item.desc }}</p>
            <p class="distance">{{ item.tags[0] }}</p>
            <div class="housePrice">
              <span>{{ item.price }}</span
              >元/月
            </div>
          </div>
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
export default {
  name: 'ListItem',
  props: {
    info: {
      type: Array,
      required: true
    }
  },
  components: {},
  data () {
    return {
      url: 'http://liufusong.top:8080'
    }
  },
  methods: {
  }
}
</script>

<style scoped lang="less">
.findList {
  ul {
    width: 100%;
    li {
      height: 120px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      border-bottom: 1px solid #ccc;
      padding: 15px;
      .imgs {
        width: 120px;
        height: 100%;
        background-color: brown;
        img {
          width: 120px;
          height: 100%;
        }
      }
      .list-content {
        flex: 1;
        height: 100%;
        margin-left: 10px;
        font-size: 12px;
        margin-top: -5px;
        h3 {
          width: 220px;
          font-size: 15px;
          color: #394043;
          white-space: nowrap;
          /* 第二步：溢出隐藏 */
          overflow: hidden;
          /* 第三步：溢出的内容省略号显示 */
          text-overflow: ellipsis;
        }
        .adress {
          color: #afb2b3;
          margin: 5px 0;
        }
        .distance {
          width: 50px;
          height: 25px;
          background-color: #e1f5f8;
          border-radius: 3px;
          color: #39becd;
          text-align: center;
          line-height: 25px;
          margin-bottom: 5px;
        }
        .housePrice {
          color: #fa5741;
          span {
            font-size: 16px;
          }
        }
      }
    }
  }
}
</style>
